package com.ccl.iot.dvr.utils;

import android.view.GestureDetector.SimpleOnGestureListener;
import android.view.MotionEvent;

import com.ccl.iot.listener.OnDVRTouchListener;

/**
 * 手势监听器
 * 
 * @author HD
 * 
 */
public class GestureListener extends SimpleOnGestureListener {
	private final OnDVRTouchListener listener;

	public GestureListener(OnDVRTouchListener listener) {
		this.listener = listener;
	}

	@Override
	public boolean onDown(MotionEvent e) {
		// 捕获Down事件
		return true;
	}

	@Override
	public boolean onDoubleTap(MotionEvent e) {
		// 触发双击事件
		listener.onDoubleClick();
		return true;
	}

	@Override
	public boolean onSingleTapUp(MotionEvent e) {
		// TODO Auto-generated method stub
		return super.onSingleTapUp(e);
	}

	@Override
	public void onLongPress(MotionEvent e) {
		listener.onLongPress();
		super.onLongPress(e);
	}

	@Override
	public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
		return super.onScroll(e1, e2, distanceX, distanceY);
	}

	@Override
	public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
		return super.onFling(e1, e2, velocityX, velocityY);
	}

	@Override
	public void onShowPress(MotionEvent e) {
		// TODO Auto-generated method stub
		super.onShowPress(e);
	}

	@Override
	public boolean onDoubleTapEvent(MotionEvent e) {
		// TODO Auto-generated method stub
		return super.onDoubleTapEvent(e);
	}

	@Override
	public boolean onSingleTapConfirmed(MotionEvent e) {
		listener.onSingleClick();
		return super.onSingleTapConfirmed(e);
	}

}
